<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<?php

	/*
		Jax Calendar v1.34 - Copyright (c) 2002-2004, Andreas John aka Jack (tR)
		This program and it's moduls are Open Source in terms of General Public Licens (GPL) v2.0

		index.php 		(function index for admin system)
	*/
	
	
    // fit if nescessary:
	define( "PATH_TO_SCRIPT", "../" );

	// global variables (have to be fitted)
	require ( dirname(__FILE__) . "/".PATH_TO_SCRIPT."settings/calendar.settings.inc.php");

	// language localization
	if ( empty( $_GET[ "language" ] ) && $language_auto_select )
    {
               echo "\n".'<script language="JavaScript" type="Text/JavaScript" src="'.PATH_TO_SCRIPT.'/modules/lang_auto_select.js"></script>'."\n";
               $language = $default_language;
    }
	else
               $language = strtolower( $_GET[ "language" ] );		
	
	// (If exists) include localization file for the favoured language
	if ( file_exists( dirname(__FILE__) . "/".PATH_TO_SCRIPT."languages/" . $language . ".inc.php" ) )
		define( "LOC_LANG", $language ); 
	else
		define( "LOC_LANG", $default_language ); 

	require_once ( dirname(__FILE__) ."/".PATH_TO_SCRIPT."languages/" . LOC_LANG . ".inc.php" );	

	$ox_tail = "cal_id=$cal_id&language=$language";
	
	?>

<head>
	<title><?php echo $loc_lang["calendar"]." - ".$loc_lang["admin_program"]; ?></title>
	<link rel="stylesheet" href="<?php echo PATH_TO_SCRIPT; ?>css/admin.css">
	<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="expires" content="0">	
</head>



<body>

<?php

	if ( $data_source == "csvfile" )
	{
		// include class for CSV-textfile support
		require ( PATH_TO_SCRIPT."modules/classes/csvfile.inc.php" );

		// prepeare objects for file access
		// list of subscribers which signed in/off
		$calendar_list        = new csvfile;
		$calendar_list->name  = PATH_TO_SCRIPT.'cal_data/'.$calendar_file;
		$calendar_list->init();
		
		$event_list        = new csvfile;
		$event_list->name  = PATH_TO_SCRIPT.'cal_data/'.$event_file;
		$event_list->init();
		
	    /**
		* @return void
		* @desc   Checks whether database is generated by older version (checks order of entries)
		*/
		function old_database()
		{
				global $calendar_list;

				$entries = $calendar_list->entries();  if ($entries == 0) return false;

				$red_data = array();
				$calendar_list->get_entry(0, $red_data);
				$last_event_start = $red_data["event_start"];
				
				for ($i=2; $i<=$entries; $i++)
				{
					$calendar_list->get_entry($i, $red_data);
					
					if ($red_data["event_start"] > $last_event_start)
						return true;
					else 
						$last_event_start = $red_data["event_start"];
				}
				
				return false;
		}
	
		if (old_database() )
		{
			echo <<<MSG
<div style="border: 1px solid black; background-color: white; color: red; padding: 20px;">
	<b>Warning!</b><br> The internal data format of Jax Calendar has changed since version 1.33!<br>
	You will need to update your csv database file!
	<p>Please <b><u>BACKUP YOUR CSV FILE(S)!!!</u></b> before running:</p>
	<p>Bitte <b><u>SICHERN SIE IHRE CSV DATEI(EN)!!!</u></b> und starten Sie dann:</p>
	<br>
	<p><a href="dbupdate.php?$ox_tail">CSV auto update system</a></p>
</div>
MSG;
		}		
		
		
	}
	

?>

<div class="admin">
<div class="title"><?php echo $loc_lang["calendar"]." - ".$loc_lang["admin_program"]; ?></div>
<p><br></p>
<table border="0" valign="middle" align="center" width="100%"><tr><td align="center">
<table border="0">
<tr><td><a href="calendar.admin.php<? echo "?cal_id=$cal_id&language=$language" ?>"></a></td><td>&nbsp;</td>
<td><a href="calendar.admin.php<? echo "?cal_id=$cal_id&language=$language" ?>"><? echo $loc_lang["calendar"]." - ".$loc_lang["admin_program"]; ?></a></td></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td>
<td><img src="http://www.jtr.de/scripting/php/updates/updateinfo.php?current_version=134&img=status&project_id=calendar">&nbsp;&nbsp;<?php echo "<a href=\"http://www.jtr.de/scripting/php/updates/updateinfo.php?current_version=134&language=$language&project_id=calendar\">{$loc_lang["check_for_updates"]}</a>"; ?></td></tr>
</table>
</td><tr></table>
<!-- Please don't remove the link to the author's website!!! -->
<p class="author_info">Jax Calendar v1.34, by Jack (tR), <a href="http://www.jtr.de/scripting/php">www.jtr.de/scripting/php</a></p>
</div>

</body>

</html>